/*
* @Author: bin
* @Date:   2016-12-02 21:51:23
* @Last Modified by:   bin
* @Last Modified time: 2016-12-02 23:44:33
*/

'use strict';
var H5ComponentPoint = function(name,cfg){
  var component = new H5ComponentBase(name,cfg);
  var base = cfg.data[0][1];
  $.each(cfg.data,function(idx,item){
    var point = $('<div class = "point point_'+idx+'">');

    var name = $('<div class="name">'+item[0]+'</div>')
    var rate = $('<div class="per">'+(item[1]*100)+'%</div>')

    name.append(rate);
    point.append(name);

    var per = (item[1]/base*100)+'%';
    point.width(per).height(per);
    if(item[2]){
      point.css('background',item[2])
    }
    if(/*item[3]*/item[3]!=undefined&&item[4]){
      point.css('left',item[3]).css('top',item[4]);
    }
    component.append(point);
  })
  return component;
}